/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.kth.lwr.jeat.core;

import java.util.LinkedList;
import java.util.List;
import javax.measure.quantity.Quantity;
import javax.measure.unit.Unit;
import org.jscience.physics.amount.Amount;

/**
 * 
 * The abstract base class for ImpactModels. An ImpactModel have to implement
 * the methods <code> Amount getImpact(Inventory)</code> as well as 
 * <code> Unit getUnit()</code>. 
 *
 * @author david
 * 
 * 
 */
public abstract class ImpactModel extends Described{
    
        
    /**
     * Creates a new ImpactModel
     * @param name name of model
     * @param description description of model
     */
    public ImpactModel(String name, String description) {
        super(name, description);           
    }

    /**
     * This method should return the Impact that arises from the emissions and 
     * resource consumptions passed as {@link Inventoriable} argument to the
     * method.
     * 
     * @param inventoriable the inventory that should be expressed as an Impact
     * @return the Impact as an <code>Amount</code> caused by the inventoriable
     */
    public abstract Amount<? extends Quantity> getImpact(Inventoriable inventoriable);
    
    /**<p>
     * This method should return the unit specifying the value of this impact.
     * Note that this is not the same as the unit of the Amount that is
     * returned from {@link getImpact} method.
     * </p>
     * If this method returns a Unit such as CO2eq, the Unit of the amount
     * returned from getImpact would be any possible {@link ProductUnit} that
     * includes CO2eq (e.g CO2eq/year).
     * 
     * @return the unit specifying the value of this impact
     */
        
    public abstract Unit getUnit();
    
    /**This method should return the Impact caused by the passed {@link Inventoriable}
     * as a Reportable object.
     * 
     * @param inventoriable the inventory that should be expressed as an Impact
     * @return the resulting impact wrapped in a Reportable object
     */
    
    
        
    public Reportable getReportableImpact(Inventoriable inventoriable) {
        final Report report=new Report();
        report.addRow(this.getName(), getImpact(inventoriable),getDescription());
        return new Reportable() {

            @Override
            public Report getReport() {
                return report;
            }
        };
    }

  
    
    
     

    
}
